package com.cysyz.web.modules.base.permission.support;

import com.cysyz.mylib.utils.PropertiesUtil;

import java.io.UnsupportedEncodingException;
import java.util.Properties;

/**
 * Created by cuiyong on 15/7/2.
 */
public enum PermissionContentType {

    LOGIN_CHECK_FAIL("login.check.fail.page"), PERMISSION_CHECK_FAIL("permission.check.fail.page");

    private String responseContent;


    private Properties permissionProperties;

    PermissionContentType(String contentKey) {
        permissionProperties = PropertiesUtil.getProperties(PermissionContentType.class.getResource("/permission.properties").getFile());

        try {
            this.responseContent = new String(permissionProperties.getProperty(contentKey).getBytes("iso-8859-1"), "utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }

    public String getResponseBody() {
        return this.responseContent;
    }

    public Properties getPermissionProperties() {
        return permissionProperties;
    }

    public void setPermissionProperties(Properties permissionProperties) {
        this.permissionProperties = permissionProperties;
    }
}
